package getsmart.project.mailsender;

import javax.mail.internet.MimeMultipart;

import getsmart.project.R;
import getsmart.project.database.LogActivity;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class MailSenderActivity extends Activity {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        LogActivity logAct = new LogActivity(this);
        LogCreator logCre = new LogCreator();
        String[] filenameList;
        filenameList = logCre.createLog(this,logAct);
    	Log.d("Button", "Clicked");
	    try {   
	        GMailSender sender = new GMailSender("getsmartsatunol@gmail.com", "satunolkpproject");
	//                    MimeMultipart _multipart = new MimeMultipart();
	        for (int i=0; i<filenameList.length; i++){
	        	sender.addAttachment(filenameList[i]);
	        }
	        sender.sendMail("Log Activity",   
	                "Berikut log activity aplikasi",   
	                "getsmartsatunol@gmail.com",   
	                "kemit_lastsword@yahoo.com");   
	        Log.d("Mail", "Send");
	    } catch (Exception e) {   
	        Log.e("SendMail", e.getMessage(), e);   
	    }
	    logAct.close();

    }
}